package game;

import java.awt.Point;

public class Piece {
	// The position of the piece is the upper left.
	private int id;
	private Point position;
	private int size;
	private boolean vertical;

	public Piece(int id, Point position, int size, boolean vertical) {
		this.id = id;
		this.position = position;
		this.size = size;
		this.vertical = vertical;
	}

	public int getId() {
		return id;
	}

	public Point getPosition() {
		return position;
	}

	public void setPosition(Point position) {
		this.position = position;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public boolean isVertical() {
		return vertical;
	}

	public void setVertical(boolean vertical) {
		this.vertical = vertical;
	}

	public boolean move(Piece piece, Point point) {
		boolean answer = false;
		return answer;
	}

	@Override
	public String toString() {
		return id + " " + position + " " + size + " " + vertical;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		result = prime * result
				+ ((position == null) ? 0 : position.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Piece other = (Piece) obj;
		if (id != other.id)
			return false;
		if (position == null) {
			if (other.position != null)
				return false;
		} else if (!position.equals(other.position))
			return false;
		return true;
	}

}
